package com.example.technologyintroandroid;

import android.graphics.Canvas;
import sheep.game.Layer;
import sheep.graphics.Image;
import sheep.math.BoundingBox;

public class GameLayer extends Layer{
/*
 * Task 1 is done using the Helicopter class
 * Task 2 is done using the Helicopter2 class, when creating Helicopter2 for task 2 you need to 
 * 		uncomment the onTouchDown function in GameState and recomment it when done
 * Task 3 is done using the Helicopter3 class 
 */
//	private Helicopter helicopter;
//	private Helicopter2 helicopter;
	private Helicopter3 helicopter;
	private Helicopter3 helicopter2;
	private Level level;
	
	public GameLayer(int width, int height){
//		helicopter = new Helicopter(new Image(R.drawable.helicopter), width, height);
//		helicopter = new Helicopter2(new Image(R.drawable.helicopter), width, height);
		helicopter = new Helicopter3(new Image(R.drawable.chopper),new Image(R.drawable.chopper2),new Image(R.drawable.chopper3),new Image(R.drawable.chopper4), width, height);
		helicopter2 = new Helicopter3(new Image(R.drawable.chopper),new Image(R.drawable.chopper2),new Image(R.drawable.chopper3),new Image(R.drawable.chopper4), width, height);
		
		level = new Level(width, height);
	}
	
	@Override
	public void update(float dt) {
		helicopter.update(dt);
		helicopter2.update(dt);
		if(helicopter.collides(helicopter2)){
			helicopter.setSpeed(-helicopter.getSpeed().getX(),-helicopter.getSpeed().getY());
			helicopter2.setSpeed(-helicopter2.getSpeed().getX(),-helicopter2.getSpeed().getY());
		}
	}

	@Override
	public void draw(Canvas canvas, BoundingBox box) {
		helicopter.draw(canvas);
		helicopter2.draw(canvas);
	}
	
//	public Helicopter getHelicopter(){
//		return helicopter;
//	}
	
//	public Helicopter2 getHelicopter(){
//		return helicopter;
//	}
	
	public Helicopter3 getHelicopter(){
		return helicopter;
	}

	public Level getLevel(){
		return level;
	}
}
